package db

import (
	"github.com/go-redis/redis"
	"sync"
	"time"
)

var RedisClient *redis.Client
var once sync.Once

func GetRedis() *redis.Client {
	once.Do(func() {
		RedisClient = redis.NewClient(&redis.Options{
			// todo:写入到配置文件中
			Addr:        ":6379",
			PoolSize:    300,
			PoolTimeout: time.Second * 10,
		})
	})
	return RedisClient
}
